{include file="public/css"}
{include file="public/js"}
<form class="layui-form" action="" style="padding:20px;background:#fff">
<input  type="hidden" name="from" value="{$Request.param.from}">
<input  type="hidden" name="to" value="{$Request.param.to}">
  <div class="layui-form-item">
    <label class="layui-form-label">维权类型</label>
    <div class="layui-input-inline" style="width:300px;">
      <select name="type" lay-verify="required">
        <option value=""></option>
        <option value="0">买家违规</option>
        <option value="1">卖家违规</option>
        <option value="2">其他举报</option>
      </select>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">具体原因</label>
    <div class="layui-input-inline" style="width:300px;">
      <textarea name="content" placeholder="请输入具体违规内容"  lay-verify="required" class="layui-textarea"></textarea>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">上传图片</label>
    <div class="layui-input-block">
    <button type="button" class="layui-btn layui-btn-primary" id="image">
  <i class="layui-icon">&#xe67c;</i>上传图片
</button>
    </div>
  </div>
   <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn layui-btn-normal" lay-submit lay-filter="form">立即提交</button>
    </div>
  </div>
</form>

<script>
layui.use(['form','layer','upload'], function(){
	var form = layui.form;
  var upload = layui.upload;

// 表单提交
form.on('submit(form)', function(data){
  $.post("{:url('@user/rights/index')}",data.field,function(json){
       if(json.code==0){
         layer.msg(json.msg);
      
       }else{
       	 layer.msg(json.msg);
       }
  });


  // console.log(data.elem) //被执行事件的元素DOM对象，一般为button对象
  // console.log(data.form) //被执行提交的form对象，一般在存在form标签时才会返回
  // console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
  return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
});




  //执行实例
  var uploadInst = upload.render({
    elem: '#image' //绑定元素
    ,accept:'images'
    ,url: '{:url("trade/upload")}' //上传接口
    ,done: function(res){
      //上传完毕回调
    }
    ,error: function(){
      //请求异常回调
    }
  });
});
</script>